home *** CD-ROM | disk | FTP | other *** search
- /**
- * Display int and hex values for the character at
- * the caret in the status bar.
- *
- * Copyright 2004 Ollie Rutherfurd <oliver@jedit.org>
- *
- * $Id: Display_Character_Code.bsh,v 1.2 2004/05/24 19:24:56 orutherfurd Exp $
- */
-
- void displayCharacterCode(View view)
- {
- JEditTextArea textArea = view.getTextArea();
- int caret = textArea.getCaretPosition();
- int line = textArea.getCaretLine();
- if(caret < textArea.getLineEndOffset(line)-1)
- {
- char c = buffer.getText(caret,1).charAt(0);
- StringBuffer buf = new StringBuffer();
- buf.append("Character at caret: ");
- buf.append("int=").append((int)c).append(", ");
- buf.append("hex=").append(Integer.toString((int)c,16));
- view.getStatus().setMessageAndClear(buf.toString());
- }
- else
- Toolkit.getDefaultToolkit().beep();
- }
-
- displayCharacterCode(view);
-